package com.rw.admin.service.impl;

import com.rw.common.mapper.MenuMapper;
import com.rw.common.pojo.Menu;
import com.rw.admin.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuServiceImpl implements MenuService {

    @Autowired
    private MenuMapper menuMapper;


    @Override
    public List<Menu> getAllMenus() {
        List<Menu> list  = menuMapper.selectAll();
        return list;
    }

    @Override
    public List<Menu> getMenusFolder() {
        List<Menu> list  = menuMapper.selectMenusFolder();
        return list;
    }

    @Override
    public boolean save(Menu menu) {
        int num = menuMapper.insertSelective(menu);
        return num > 0;
    }

    @Override
    public boolean delete(Integer id) {
         int i = menuMapper.deleteByPrimaryKey(id);
        return i>0;
    }
}
